/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package it.kirys.rilego.engine.processors;

import it.kirys.rilego.engine.loaders.imagesources.ImageType;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
 *
 ** @author Federico Improta
 */
public class PNGCompressor implements ICompressor{

	@Override
	public ProcessorOutput compress(BufferedImage input) {
		ProcessorOutput p = new ProcessorOutput();
		p.setType(ImageType.PNG);
		try {
			ImageIO.write(input, "png", p);
		} catch (IOException ex) {
			Logger.getLogger(PNGCompressor.class.getName()).log(Level.SEVERE, null, ex);
			return null;
		}
		return p;
	}

}
